//
//  KHHMuscieTableViewCell.m
//  Travel
//
//  Created by dllo on 15/12/5.
//  Copyright © 2015年 doll. All rights reserved.
//

#import "KHHMuscieTableViewCell.h"
#import "Masonry.h"
#import "UIImageView+WebCache.h"

@interface KHHMuscieTableViewCell ()
@property (nonatomic, retain)UIImageView *imageV;
@property (nonatomic, retain)UILabel *titleLabel;
@property (nonatomic, retain)UILabel *detailLabel;
@end

@implementation KHHMuscieTableViewCell

//初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageV = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV];
        
        self.titleLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.titleLabel];
        
        self.detailLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.detailLabel];
        
    }
    return self;
}

//布局

- (void)layoutSubviews
{
    [super layoutSubviews];
    //    self.imageV.backgroundColor = [UIColor greenColor];
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(90, 90));
        make.left.mas_equalTo(self.contentView.mas_left).offset(10);
        make.top.mas_equalTo(self.contentView.mas_top).offset(5);
    }];
    self.imageV.layer.cornerRadius = 45;
    
    self.titleLabel.numberOfLines = 0;
    self.titleLabel.font = [UIFont boldSystemFontOfSize:17];
    //    self.titleLabel.backgroundColor = [UIColor orangeColor];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(260, 40));
        make.left.mas_equalTo(self.contentView.mas_left).offset(110);
        make.top.mas_equalTo(self.contentView.mas_top).offset(10);
    }];
    
    self.detailLabel.font = [UIFont systemFontOfSize:14];
    //    self.detailLabel.backgroundColor = [UIColor yellowColor];
    [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(260, 40));
        make.left.mas_equalTo(self.contentView.mas_left).offset(110);
        make.top.mas_equalTo(self.contentView.mas_top).offset(60);
    }];
}

//赋值
- (void)setModel:(KHHMuscieModel *)model
{
    self.titleLabel.text = model.title;
    self.detailLabel.text = model.albumTitle;
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:model.coverSmall]];
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
